<template>
	<view>
		<view style="font-size: 30upx;color: #333;font-weight: bold;margin: 20upx 0 0 20upx;">编写实践报告</view>
		<textarea adjust-position auto-height  maxlength="1000" class="style1" placeholder="编写实践报告" v-model="content" :disabled="commitStatus == 3"></textarea>
		<button v-if="commitStatus!=3" class="mini-btn style2" type="warn" size="mini" @click="commitReport">提交</button>
		<button v-else class="mini-btn style2" type="warn" size="mini" @click="checkResult">查看成绩</button>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				taskedId:0,//任务id
				content:'',//实践报告内容
				commitStatus:0,//任务批阅状态
			}
		},
		onShow(){
			
		},
		onLoad(option){
			this.taskedId = option.id;
			this.commitStatus = option.commitStatus;
			this.getActiviReport();
		},
		created() {
		},
		methods:{
			//学生查看任务报告成绩
			checkResult(){
				let that = this;
				uni.navigateTo({
					url:"./chakanchengji?id=" + that.taskedId
				})
			},
			//获取学生的实践报告
			getActiviReport(){
				let that = this;
				that.pyReq(that.$http.getActiviReport,{taskedId:that.taskedId},function(res){
					that.content = res.result;
				});
			},
			//提交实践报告
			commitReport(){
				let that = this;
				that.pyReq(that.$http.commitReport,{id:that.taskedId,content:that.content},function(res){
					uni.reLaunch({
						url:'/pages/index/renwu/renwuxue',
					})
				});
			}
		}
	}
</script>

<style>
	.style1{
		width: 664upx;
		margin: 40upx 20upx 0 20upx;
		border: #666 1px solid;
		border-radius: 10upx;
		padding: 10upx 20upx;
		font-size: 26upx;
		min-height: 600upx;
	}
	.style2{
		float: right;
		margin-right: 20upx;
		margin-top: 20upx;
	}
</style>
